Repository navigation
Conversation
JasperGeurtz
reviewed
Nov 6, 2026
| } | ||
|
|
||
| private long addressAt(int offset) { | ||
| // Translate on the selected buffer: unsafe async can switch layouts during a read. |
Collaborator
There was a problem hiding this comment.
Do note that this approach requires quite a few branches, I'm not sure this is good for performance. @ Astra is there really no way to make the original approach work (fixing what was wrong), but making it really statically calculated offsets instead of these branches here?
Contributor
Author
There was a problem hiding this comment.
(Actually Dan) Yeah static offsets would be better. Will get you that.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When unsafe async moves a running bot from the live buffer to a packed frame, #105 can calculate an offset using one layout and read it using the other. Retained Event, Position, Command, and UnitCommand views also keep layout-dependent offsets across the handoff. This can return incorrect data or access invalid native memory.
Keep all generated offsets in the original BWAPI layout and translate them inside the selected WrappedBuffer at the primitive/string access. Publish ClientData.buffer through a volatile reference, remove the redundant dynamic overrides, and update the generator. Static-data routing, the four copy ranges, and unsafe async's start-before-copy scheduling stay unchanged. Packed slots remain 4,805,308 bytes instead of 33,017,048 bytes.
This PR is based on #105 (
a1574049) and targets itsimplement-memory-safebranch.Validation: